import request from '@/api/utils/requery'

// 资源管理模块

// 学科的增删查改
// 根据学科 id 查询学科(含有相对应的阶段和项目)
export const SearchSubjectById = subjectId => {
    return request({
        url:`subject/selectBySubjectId?subjectId=${subjectId}`
    })
}

// 查询所有学科
export const SearchAllSubject = () => request({
    url:"subject/selectAllSubject"
})

// 修改学科
export const UpdateSubject = data => {
    return request({
        method: 'post',
        url: 'subject/update',
        headers: {
            "Content-Type": "application/json",
        },
        data: data
    })
}

// 删除学科
export const DeleteSubject = data => {
    return request({
        url:`subject/delete?name=${window.decodeURIComponent(data)}`
    })
}

// 修改阶段
export const UpdateStage = data => {
    return request({
        method: 'post',
        url: 'stage/update',
        headers: {
            "Content-Type": "application/json",
        },
        data: data
    })
}

// 删除阶段
export const DeleteStage = data => {
    return request({
        url:`stage/delete?stageId=${data}`
    })
}

// 阶段分页
export const SelectStageAll = (x1, x2, x3, x4) => {
    return request({
        method: 'post',
        url:`stage/selectStageAll?subjectName=${x1}&&selectByCondition=${x2}&&pageNum=${x3}&&pageSize=${x4}`,
    })
}

//批量删除关卡
export const DeleteAllCheckP = data => {
    return request({
        method:'post',
        url:`customspass/deleteCustomspassById?ids=${data}`
    })
}

// 增加关卡
export const AddCheckPoints = (x1, x2, x3, x4, x5, x6) => {
    return request({
        method: 'post',
        url:`customspass/insertCustomspass?stageId=${x1}&&lastCustomspassId=${x2}&&name=${window.decodeURIComponent(
          x3)}&&introduce=${window.decodeURIComponent(x4)}&&require=${window.decodeURIComponent(x5)}&&time=${x6}`
    })
}

// 增加图片
export const AddCheckPointsPcture = data => {
    return request({
        method: "post",
        url: "customspass/uploadImg",
        data:data
    })
}

//修改关卡
export const UpdateCheckPoints = (x2, x3, x4, x5, x6) => {
    return request({
        method: 'post',
        url:`customspass/updateCustomspass?customspassId=${x2}&&name=${window.decodeURIComponent(
          x3)}&&introduce=${window.decodeURIComponent(x4)}&&require=${window.decodeURIComponent(x5)}&&time=${x6}`
    })
}

//关卡分页
export const SelectCheckPoints = (x1, x2, x3, x4, x5) => {
    return request({
        method: 'post',
        url:`subject/selectBySubjectIdPro?subjectId=${x1}&&stageId=${x2}&&selectByCondition=${x3}&&pageNum=${x4}&&pageSize=${x5}`
    })
}